package aj.config;

import java.io.FileWriter;
import java.io.IOException;

/**
 * 以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。 <br/>
 * 该代码仅供学习和研究支付宝接口使用，只是提供一个参考。<br/>
 * @author 吴宇亮 on 2019/11/1 0001 下午 12:03
 */
public class AlipayConfig {

    //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016101700707806";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHZfHQp1D8rBye2Yf0L9311aQExpKLNV2HC36bMLTk8VzSZkttgCV9F01ZwNfUpPDjIsE5gbJw1Rt4cVJPJXEk+Rc5o+zHTM23bRVJdDuTfwSlw9nUfjdqKZjqR/YE/jg9hSSejlZGIvspWsoN0+Ih+qc4eVeNCpI7XjjNdqHJHZWHj8Cpe8TAwTuMtw8IG9YUC07uSilbtyiKg5TBoi10vzrq8iRYVEd8vAjz7341zsISpKy0C8gzp/yIVUtOBYY4XoVpzq+YiUUOwCXw6nlrup7EOxJMiA5Ai8ksukgqD16SiZme+PtyxSF/QJK33qT3ftujs/9DeAE76NlKhWzNAgMBAAECggEAYtF8ANsawM4PNQ47WWHrj2y8Z319nK3q1wV0TjbaP2f6h28YzICok5DbzbJLhF/l3bsYpYZIR7Dld1A56W114EvuHavGqZK/lLrjxM5sxBE73WbtamjOz7cjyF+3ZgwTFTIJzuZdjU7CyGDtJ+Ms+4f8HXnNUOG/TNrKLdEwJrm5c/wwzJygK7+RruG0+syoT9Fzsc2qRHZ/LBUJ+BSAvhR5cekWWT7S+kx+O9TYMMVNsF55hfsEa3mMXI3Xxr8sV+sa/h+A1N9MPmKinivjAeWV/E+xskeIs7+BLOOFrK9H/eHlXcq9rP42mGZgF/3NNsEPbZEfD1TlKmiyweXDxQKBgQDs0AApFy2yngArKlOGTg7DHpg65W2J3cutMlvs7NDD5xNcwWUpSFkBIjUJQDro5iA755RhCPTRxGOM2eYMSe1aGk4cdVSHM3e2N0vw3YML55AcJQMqrwzLFb0SFELMo64i3PMu7LZtetJFmHOAT9N1g7x6CRKZBS1pJDLdm3jFJwKBgQDXjeQ5FV0gkJWPTAhG9o5owDNTEKmD9X/xRUCN8iKpWo4FuhxOJOYoOkM1lLRu7cqEc9hLcaw+r2lTTCTqiCp3PX55o7DDxyS759VulaJ0bjXAPIm+YGzy4vwjzyKEkF/jUbEYbybSawbn/NzxQHQBtV32g5ZF3kntmCY+0W8+6wKBgQDo5xzxTLmF7T0PNv6UnVqJbiKb8h7MM9XoThn4p2Qe97mkRRRACMZ4hfMRWRlXC1VydS0KTiuxzut1kKxfM6n7LtnZxU9P9T9sd2/5wXHsGF80PvahWS5E4elkyYZ1Cxntcc6+PNKiU+RPzEL0VA4NinWotBmVY3Eo8hAQwaKCiwKBgBr+Qtk/KqVcVc5XGCZC0/ycLRE24fOLd9Uv9fCQpPSOSYDAGLFUf5oECcyY7auCjbzegPSZrJdBAjCTNYBFQwQhqEf1TrqFor0BQEIT7P8lmgeTzTARBTO5ZxfY5ZqyNb/SyBmmObdZ/chpawWvK5fXLYgkXFothxaA2jE9qu+3AoGALrMyz84msrkfoYN2tFeAw1K4gtcURwFWJ0iKzKk/P0f2QdToXH5Ry9n+1jdoYVTQ0PTRYPzb3dgK1TcQCvSN74UXK1vtPTzASaE2/pc4p8GohqqUlK9caPyggANu/LsVRhlkZavhIz22w6XZDpbyCuUK7TyVfplaAX1d47uv36w=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsVlYqHBFLXDQCjwKY6NxyXD4I84OI7zrKTNs4/aUZroDZu86MtK7aDQxNaYDPAxwDfhtdjyqviEkO4W0JkMn2kGqJhHCVyshciK2Cqq4mo0/BV6b3aw4iTvG/SxybubkYC5K8oGd6dTSAV3DPxDGL98ytooEUH0WuUNKZlup18SYjegmzTFiSQQfztQsDlPR7pybbnJhf6qg6sW6LcgwE1rNI+ZaR/paVUDRHj0x6QW43aqYWDNv6yDqC190nIGWPPqqxBcBOUg0neEQ/Wksar4+Y9UKaKy44H3w0WDXMtYm1FhF/4MpjN09fEm7T+5uO4WCEAKngwShqYMmuANCGwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost/demo/alipay/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost/demo/alipay/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
//    public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
